<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/shadow-dom.js"></script>
<div id="x"><span></span></div>
<div id="x"><span></span></div>
<div id="host">
  <template data-mode="open">
    <div id="y"><span></span></div>
    <div id="y"><span></span></div>
  </template>
</div>
<script>
convertTemplatesToShadowRootsWithin(host);
test(() => {
  assert_equals(document.querySelectorAll('#x').length, 2);
  assert_equals(document.querySelectorAll('#x span').length, 2);
}, 'querySelectorAll for multiple #Ids in a document tree');

test(() => {
  assert_equals(host.shadowRoot.querySelectorAll('#y').length, 2);
  assert_equals(host.shadowRoot.querySelectorAll('#y span').length, 2);
}, 'querySelectorAll for multiple #Ids in a shadow tree');
</script>
